{

    function fn () {

        let a = 100;
        return function () {
            let num = a + 100;
            return num;
        }
    }

    let f = fn();

    console.log(f());

}

{
    // 闭包 变量是否销毁
    function add () {
        var num = 0;
        return function () {
            return num += 1;
        }
    }

    console.log(add()());
    console.log(add()());
    console.log(add()());

    let a = add();

    console.log(a());
    console.log(a());
    console.log(a());
}

